<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="yes" name="apple-touch-fullscreen">
    <meta content="telephone=no,email=no" name="format-detection">
    <!--防止css、js资源缓存-->
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <script type="text/javascript" src="asserts/resource/js/flexible_C.js" ></script>
    <title>实时听音</title>
    <link rel="stylesheet" href="asserts/resource/mui/css/mui.min.css" />
    <link rel="stylesheet" href="asserts/resource/css/common.css">
    <link rel="stylesheet" href="asserts/resource/css/css.css">
</head>
<body id="callup">
<div class="mui-content calluping">
    <ul class="mui-table-view">
        <li class="mui-table-view-cell">
            <p>
                <em>1、</em><strong>只有亲情号码可以使用该功能。 <a class="abs" href="Setting.html">前往设置</a></strong>
            </p>
            <p><em>2、</em><strong>第一次使用时，需要发送短信"monitor123456"到设备进行激活。<br/>
                <span class="spanUnderline">已激活的设备，忽略此步骤。</span><a class="abs" id="sendSms" href="javascript:void(0);">发送短信</a></strong></p>
            <p><em>3、</em><strong>点击电话按钮后，手机将拨打设备电话，设备自动接通，进行听音。</strong></p>
        </li>
        <li class="mui-table-view-cell">
            <p>
                亲情号码：<span id="num1"></span>
            </p>
            <p>设备号码：<span id="num2"></span>
            </p>
        </li>
    </ul>
    <p class="callpWrap">
        <span class="terminal"><a id="callTerminal" class="callphone" href="javascript:void(0);"></a></span>
    </p>
</div>
</body>
<script type="text/javascript" src="asserts/resource/js/jquery.min.js"></script>
<script type="text/javascript" src="asserts/resource/layer/mobile/layer.js"></script>
<script type="text/javascript" src="asserts/resource/mui/js/mui.min.js"></script>
<script type="text/javascript" src="asserts/resource/js/js.js"></script>
<script>
    //手机系统判断
    var u = navigator.userAgent, app = navigator.appVersion;
    var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端

    getData('set/selectSetting',settingInfoData);

    getData('termianlinfo/selectTerminalInfo',terminalInfoData);

    //通用ajax请求
    function getData(url,callBack) {
        $.ajax({
            url :url,
            type : 'post',
            dataType : 'json',
            success :callBack,
            error : function() {
                layerMsg("网络异常!",2)
            }

        })
    }

    //设备信息查询回调函数
    function terminalInfoData(res) {
        var data=res.data;
        if(res.status==1){
            //短信内容附带
            var msgContent='';

            //安卓使用?附带短信内容，苹果使用&
            if(isAndroid){
                msgContent='?body=monitor123456';
            }else{
                msgContent='&body=monitor123456';
            }
            //设备号码显示

            if(data.terminalPhone){
                $("#num2").html(data.terminalPhone);
                $('#callTerminal').attr("href","tel:"+data.terminalPhone);
                $('#sendSms').attr("href","sms:"+data.terminalPhone+msgContent);
            }else{
                $("#num2").html("设备号码未录入");
                $('#callTerminal').attr("href",'javascript:void(0);');
                $('#sendSms').attr("href",'javascript:void(0);');
            }

        }
    }

    //设置信息查询回调函数
    function settingInfoData(res) {
        var  data=res.data;
        if(data){
            if(res.status==1) {
                //亲情号码显示
                $("#num1").html(data.msgPhonenum);
            }
        }else {
            $("#num1").html('未设置亲情号码,请参考步骤1');
        }

    }


</script>

</html>
